package com.example.birdfriends.utils.encoder;


import com.alibaba.fastjson.JSONObject;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
import java.util.HashMap;

public class EncoderServer implements Encoder.Text<HashMap> {
    @Override
    public String encode(HashMap hashMap) throws EncodeException {
        try{
            return JSONObject.toJSONString(hashMap);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
